﻿using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.IO;

namespace Rison.Web.ZP
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class download : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string fileName = context.Request["fileName"];
            if(!String.IsNullOrEmpty(fileName)){
                string path = context.Server.MapPath("~/downloaddoc/") + fileName;
                FileInfo fi = new FileInfo(path);
                context.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName));
                context.Response.WriteFile(fi.FullName);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
